def use_easy():
    set1 = set()  # 定义空集合
    print(set1)

    set2 = {1,2,3,4,5}  # 不支持随机访问（不能下标）
    set3 = set2.add(6)
    print(set2)

    x = set2.copy()
    print(x)

    a = {'a','b','c'}
    b = {'b','d','e','f'}
    c = {x for x in 'abcacdrdf' if x not in 'abc'}
    print(c)

def use_generator():
    """
    使用生成式
    :return:
    """
    my_tuple = tuple(x for x in range(18)) # 元组生成式
    print(my_tuple)

    my_set = {x for x in 'abcdefg'}
    print(my_set)



if __name__ == '__main__':
    use_generator()
